package com.ruoyi.system.api.config;
import feign.Client;
import feign.Logger;
import feign.Request;
import feign.Response;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;

@Configuration
public class FeignConfig {
   @Bean
   public Logger.Level feignLoggerLevel() {
       return Logger.Level.FULL;
   }
    @Bean
    public Client feignClient() {
        return new Client.Default(null, null) {
            @Override
            public Response execute(Request request, Request.Options options) throws IOException {
                // 自定义Options，禁用重定向
                Request.Options customOptions = new Request.Options(
                        options.connectTimeoutMillis(),
                        options.readTimeoutMillis(),
                        false  // 禁用重定向
                );
                return super.execute(request, customOptions);
            }
        };
    }
}
